﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Ucb.Workshop.Business.Util;
using Ucb.Workshop.Business;

namespace Ucb.Workshop.WinApp.View.GestionCaja
{
    public partial class ControlRegistroCaja : UserControl
    {
        public ControlRegistroCaja()
        {
            InitializeComponent();
        }

        private void txtMonto_TextChanged(object sender, EventArgs e)
        {
            UtilControl.EsDecimal(txtMonto);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (UtilControl.ValidarTextBox(txtGastos) && UtilControl.ValidarTextBox(txtMonto))
            {
                Caja caja = new Caja();
                caja.Gasto = txtGastos.Text.Trim();
                caja.Monto = int.Parse(txtMonto.Text.Trim());
                caja.Fecha = DateTime.Now;

                caja.Insertar();
            }
            else
            {
                MessageBox.Show("Debe llenar los datos");
            }
        }
    }
}
